//
//  CodeLayoutView.swift
//  Lottery
//
//  Created by 薛永伟 on 2018/12/13.
//  Copyright © 2018年 薛永伟. All rights reserved.
//

import UIKit

protocol ViewCodeLayoutable:NSObjectProtocol {
    
    func codeCustomSubviews()
}

class CodeLayoutView: UIView ,ViewCodeLayoutable{
    
    func codeCustomSubviews() {
        
        YRLog("\(self.classForCoder)CodeLayoutView派生类应该遵循ViewCodeLayoutable协议", type: .error)
    }
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        codeCustomSubviews()
    }
    
    required init?(coder aDecoder: NSCoder) {
        super.init(coder: aDecoder)
        codeCustomSubviews()
    }
    

}


/// 代码布局的ReusableView（header，footer等）
class CodeLayoutReusableView: UICollectionReusableView ,ViewCodeLayoutable{
    
    lazy var spLine: UIView = {
        let view = UIView()
        view.backgroundColor = UIColor.Separator.XEAEAEB
        return view
    }()
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        codeCustomSubviews()
    }
    
    required init?(coder aDecoder: NSCoder) {
        super.init(coder: aDecoder)
        codeCustomSubviews()
    }
    
    func codeCustomSubviews() {
        YRLog("CodeLayoutView派生类应该遵循ViewCodeLayoutable协议", type: .error)
    }
}

/// 使用code布局的collectionViewCell
class CodeLayoutCollectionViewCell: UICollectionViewCell ,ViewCodeLayoutable{
    
    lazy var spLine: UIView = {
        
        let view = UIView()
        view.backgroundColor = UIColor.Separator.XEAEAEB
        return view
    }()
    
    lazy var rightAcessImgView: UIImageView = {
        
        let view = UIImageView()
        view.contentMode = .scaleAspectFit
        view.image = UIImage.init(named: "come_right_箭头")
        return view
    }()
    
    func codeCustomSubviews() {
        
        YRLog("\(self.classForCoder)应该遵循ViewCodeLayoutable协议", type: .error)
    }
    
    override init(frame: CGRect) {
        
        super.init(frame: frame)
        codeCustomSubviews()
    }
    
    required init?(coder aDecoder: NSCoder) {
        
        super.init(coder: aDecoder)
        codeCustomSubviews()
    }
}

/// 使用code布局的tableViewCell
class CodeLayoutTableViewCell:UITableViewCell,ViewCodeLayoutable{
    
    lazy var rightAcessImgView: UIImageView = {
        let view = UIImageView()
        view.contentMode = .scaleAspectFit
        view.image = UIImage.init(named: "come_right_箭头")
        return view
    }()
    
    lazy var spLine: UIView = {
        let view = UIView()
        view.backgroundColor = UIColor.Separator.XEAEAEB
        return view
    }()
    
    func codeCustomSubviews() {
        YRLog("\(self.classForCoder)应该遵循ViewCodeLayoutable协议", type: .error)
    }
    
    override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        codeCustomSubviews()
    }
    
    required init?(coder aDecoder: NSCoder) {
        super.init(coder: aDecoder)
        codeCustomSubviews()
    }
    
}
